package xuan.mall.system.interfaces.facade;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import xuan.mall.system.application.service.AuthAppService;
import xuan.mall.system.interfaces.dto.request.LoginRequestDTO;
import xuan.mall.system.interfaces.dto.response.Response;
import xuan.mall.system.interfaces.dto.response.TokenDTO;

@RestController
@RequiredArgsConstructor
public class AuthController {

    private final AuthAppService authAppService;

    @PostMapping("/login")
    public Response<TokenDTO> login(@RequestBody LoginRequestDTO loginRequestDTO) {
        return authAppService.login(loginRequestDTO.getUsername(), loginRequestDTO.getPassword());
    }
}